package com.boot.study.product;


import com.boot.study.config.RedisMQTemplate;
import com.boot.study.message.SameasAddMessage;
import com.boot.study.message.SameasCDEMessage;
import com.boot.study.message.SameasDelMessage;
import com.boot.study.message.SameasUpdateMessage;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;


@Component
public class MsgProducer {

    @Resource
    private RedisMQTemplate redisMQTemplate;

    /**
     * 发送 添加 消息
     */
    public void sendEmbeddedAddMessage(List<String> databaseCodeList) {
        SameasAddMessage message = new SameasAddMessage();
        message.setDatabaseCodeList(databaseCodeList);
        redisMQTemplate.send(message);
    }


    /**
     * 发送 删除 消息
     */
    public void sendEmbeddedDelMessage(List<String> ids) {
        SameasDelMessage message = new SameasDelMessage();
        message.setIdList(ids);
        redisMQTemplate.send(message);
    }

    /**
     * 发送 编辑 消息
     */
    public void sendEmbeddedUpdateMessage(List<String> databaseCodeList) {
        SameasUpdateMessage message = new SameasUpdateMessage();
        message.setDatabaseCodeList(databaseCodeList);
        redisMQTemplate.send(message);
    }


    /**
     * 发送  消息
     */
    public void sendEmbeddedCDEMessage(String databaseId) {
        SameasCDEMessage message = new SameasCDEMessage();
        message.setDatabaseId(databaseId);
        redisMQTemplate.send(message);
    }



}
